package com.zhuangxiaoyan.jvm.chapter01;

/**
 * @Classname SonTest
 * @Description TODO
 * @Date 2021/12/4 11:10
 * @Created by xjl
 */

class Father {
    int x = 10;

    public Father() {
        this.print();
        x = 20;
    }

    private void print() {
        System.out.println("Father.x=" + x);
    }
}

class Son extends Father{
    int x=30;
    public Son(){
        this.print();
        x=40;
    }
    public void print(){
        System.out.println("son.x="+x);
    }
}

public class SonTest {
    public static void main(String[] args) {

        Father f=new Son();
        System.out.println(f.x);

    }
}
